Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@turf/rhumb-bearing
Advanced tools
@turf/rhumb-bearing is a module from the Turf.js library that calculates the bearing between two geographical points along a rhumb line (a line of constant bearing). This is useful for navigation and mapping applications where you need to determine the direction from one point to another.
Calculate Rhumb Bearing
This feature calculates the rhumb bearing between two geographical points. The code sample demonstrates how to use the `rhumbBearing` function to find the bearing from point1 to point2.
const turf = require('@turf/turf');
const point1 = turf.point([0, 0]);
const point2 = turf.point([10, 10]);
const bearing = turf.rhumbBearing(point1, point2);
console.log(bearing);
Geolib is a library for geospatial calculations. It provides a variety of functions for distance, bearing, and other geographical calculations. Unlike @turf/rhumb-bearing, Geolib offers a broader range of geospatial utilities but may not be as specialized in rhumb line calculations.
Geodesy is a library for geodesic and rhumb line calculations. It offers detailed and precise methods for calculating distances, bearings, and other geospatial metrics. Compared to @turf/rhumb-bearing, Geodesy provides more comprehensive geodesic calculations but may be more complex to use.
Takes two points and finds the bearing angle between them along a Rhumb line i.e. the angle measured in degrees start the north line (0 degrees)
start
Coord starting Point
end
Coord ending Point
options
Object? Optional parameters
options.final
boolean calculates the final bearing if true (optional, default false
)var point1 = turf.point([-75.343, 39.984], {"marker-color": "#F00"});
var point2 = turf.point([-75.534, 39.123], {"marker-color": "#00F"});
var bearing = turf.rhumbBearing(point1, point2);
//addToMap
var addToMap = [point1, point2];
point1.properties.bearing = bearing;
point2.properties.bearing = bearing;
Returns number bearing from north in decimal degrees, between -180 and 180 degrees (positive clockwise)
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this single module individually:
$ npm install @turf/rhumb-bearing
Or install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf
FAQs
turf rhumb-bearing module
The npm package @turf/rhumb-bearing receives a total of 0 weekly downloads. As such, @turf/rhumb-bearing popularity was classified as not popular.
We found that @turf/rhumb-bearing demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.